---
import { Code } from '@astrojs/starlight/components';

const code = `
Future<int> sumStream(Stream<int> stream) async {
    int sum = 0;
    await for (int value in stream) {
        sum += value;
    }
    return sum;
}
`;
---

<Code code={code} lang="dart" title="sum_stream.dart" />
